Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16079 Many fixes to Approval Type component #257

Merged
merged 2 commits into from
Sep 10, 2024
Merged

16079 Many fixes to Approval Type component #257

merged 2 commits into from
Sep 10, 2024

Conversation

severinbeauvais
Copy link
Collaborator

@severinbeauvais severinbeauvais commented Sep 10, 2024

Issue #: bcgov/entity#16079

Description of changes:

  • added invalid-section styling
  • fixed whitespace
  • simplified v-radio template
  • fixed rules
  • fixed change/input/error handling
  • added validate prop
  • updated court order number rules text
  • fixed initial state (when mounted)
  • fixed validations
  • fixed lint issues
  • updated/fixed unit tests

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the business-filings-ui license (Apache 2.0).

- fixed whitespace
- simplified v-radio template
- fixed validations
- fixed change/input/error handling
- added validate prop
- updated court order number rules text
- fixed initial state (when mounted)
- fixed validation
- fixed lint issues
@severinbeauvais
Copy link
Collaborator Author

Hello. Please review these changes while I work on the unit tests.

I am aware that some of these changes will break existing users of this component. For this reason, I will update the minor version number of this component (ie, from 1.0.61 to 1.1.0). (I can't use 2.x.x because it's already used for Vue3 code.)

<div
id="approval-type"
:class="{ 'invalid-section': invalidSection }"
>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example:

image

>
<v-radio-group
v-model="approvalTypeSelected"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed redundant to use both a v-model property and handle the change event so I went with :value and @change to keep things consistent with the other components in here.

label="Court Order Number"
:rules="courtOrderNumRules"
:value="courtOrderNumber"
:rules="validate ? courtOrderNumRules : []"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rules are conditional on the validate prop (but you have to wait a tick for validation to happen).

hide-details="auto"
filled
@input="courtOrderNumberChanged"
@update:error="emitValidationError($event)"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant. Now handled more elegantly below.


/** Show only the court order option; remove via registrar option. */
@Prop({ default: false }) readonly isCourtOrderOnly!: boolean
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replaced this with approvedByCourtOrder (similar to approvedByRegistrar), which keeps the flag isCourtOrderRadio, below, functionally separate -- they do separate things instead of being dependent on each other.

}
if (!this.isCourtOrderRadio) {
this.approvalTypeSelected = ApprovalTypes.VIA_COURT_ORDER
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no more need for "default" state handling. When we come in to this component, we should have either approvedByRegistrar or approvedByCourtOrder set.

If both are set (in error) then only the first one will have an effect.

If neither are set (in error) then no radio buttons are pre-selected, but the component should still function correctly once the user selects one.

if (this.approvalTypeSelected === ApprovalTypes.VIA_COURT_ORDER) {
let status = this.$refs.courtNumRef.validate()
this.$emit('valid', status)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use this all over the code. We should have a single place where a property is emitted. This is now THIS method (as per @Emit decorator).

@severinbeauvais
Copy link
Collaborator Author

See bcgov/entity#16079 for more screenshots.

Copy link
Collaborator

@JazzarKarim JazzarKarim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from my one question, looks great!

I bet this grew in size to what was expected. Needed lots of work.

@severinbeauvais severinbeauvais changed the title 16079 Many fixed to Approval Type 16079 Many fixes to Approval Type Sep 10, 2024
@severinbeauvais severinbeauvais changed the title 16079 Many fixes to Approval Type 16079 Many fixes to Approval Type component Sep 10, 2024
- updated/fixed unit tests
@severinbeauvais severinbeauvais merged commit 83d8c8c into main Sep 10, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants